package org.study.swing.study11;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ApplicationContext;
import org.study.swing.study11.example.MyApplicationFrame;

import javax.swing.*;

/**
 * 作用描述
 *
 * @author doveylovey
 * @version v1.0.0
 * @email 1135782208@qq.com
 * @date 2024年11月12日
 */
@SpringBootApplication
@MapperScan(basePackages = {"org.study.swing.study11.mapper"})
public class JavaSwingApplication {
    public static void main(String[] args) {
        ApplicationContext context = new SpringApplicationBuilder(JavaSwingApplication.class)
                .headless(false)
                .run(args);
        MyApplicationFrame appFrame = context.getBean(MyApplicationFrame.class);
        SwingUtilities.invokeLater(() -> {
            // 设置窗口标题
            appFrame.setTitle("SpringBoot 与 Swing 集成示例");
            // 设置窗口大小
            appFrame.setSize(600, 400);
            // 将窗口居中显示在屏幕上
            appFrame.setLocationRelativeTo(null);
            appFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            appFrame.setVisible(true);
        });
    }
}
